<template>
  <div class="activity-wrapper">
    <div v-if="isIntro" v-html="content"></div>
    <div v-if="!isIntro" v-html="agenda"></div>
  </div>
</template>
<script>
/**
 * 活动简介
 */
import {getActivityInfo} from '@/api/warning';

  export default {
    data() {
      return {
        content: '',
        agenda: '',
      }
    },
    computed:{
      isIntro() {
        return this.$route.query.type != 'agenda';
      },
      activityId() {
        return this.$route.query.aid || ''//'d2fb9018-a5e0-4ce1-bb31-e1ed48c1aadc';
      }
    },
    created() {
      this.$store.commit('set_top_title','活动');
    },
     /* getActivityInfo接口返回格式：
      - {
            "data": - {                //类型：Object  必有字段  备注：无
                "id":"d2fb9018-a5e0-4ce1-bb31-e1ed48c1aadc",                //类型：String  必有字段  备注：无
                "content":"11111111111111111",                //类型：String  必有字段  备注：无
                "agenda":"mock",                //类型：String  必有字段  备注：无
                "collection_count":0                //类型：Number  必有字段  备注：无
            },
            "code":0,                //类型：Number  必有字段  备注：无
            "message":"请求响应成功"                //类型：String  必有字段  备注：无
        }
      */
    mounted() {
      getActivityInfo({activity_id: this.activityId}).then((res) => {
        if(res.data && res.data.content) {
          this.content = res.data.content;
          this.agenda = res.data.agenda;
        }
      })
    }
  }
</script>
<style>
.activity-wrapper{
  padding: 14px 19px 0;
  text-align: left;
  margin-bottom: 52px;
  color: #222222;
  font-size: 14px;
  line-height: 22px;
}
</style>

